package sal.demo;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.jsp.PageContext;

import net.sourceforge.krama.exception.InvalidOnClickCall;
import net.sourceforge.krama.listener.TMouseEvent;
import net.sourceforge.krama.listener.TMouseListener;
import net.sourceforge.krama.tag.Ajax;
import net.sourceforge.krama.tag.ILib;
import net.sourceforge.krama.tag.TLib;
import net.sourceforge.krama.tag.TView;
import net.sourceforge.krama.tag.panel.TGlobalPanel;
import net.sourceforge.krama.tag.panel.THorizontalPanel;
import net.sourceforge.krama.tag.panel.TPanel;
import net.sourceforge.krama.tag.panel.TVerticalPanel;
import net.sourceforge.krama.tag.widget.TImage;
import net.sourceforge.krama.tag.widget.TLabel;
import net.sourceforge.krama.tag.widget.TLink;
import net.sourceforge.krama.util.TColor;

/**
 * 
 * @author chabane
 *
 */
public class View extends TView {

	public String start(Object obj, PageContext context) throws IOException,
			IllegalArgumentException {

		TGlobalPanel panel = new TGlobalPanel(context, "mondiv");
		panel.setWidth("800px");
		
		THorizontalPanel ajaxPanel = new THorizontalPanel("ajax-label-call");
		ajaxPanel.setBackground("#FFF000");
		ajaxPanel.setWidth("800px");
		ajaxPanel.setHeight("400px");
		ajaxPanel.setId("message");

		ajaxPanel.addTMouseListener(new TMouseListener() {

			public String onClick() throws IllegalArgumentException {

				return Ajax.show("operation", "valeur", new ArrayList() {
					{
						add(2);
						add(3);
						add("somme");
					}
				});
			}
		}, ajaxPanel.getId());
		
		
		panel.add(ajaxPanel);
		return panel.show();
	}

}
